// eslint-disable-next-line
import { UserLayout, BasicLayout, RouteView, BlankLayout, PageView } from '@/components/layouts'
import { bxAnaalyse } from '@/core/icons'

export const asyncRouterMap = [

  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: { title: '首页' },
    redirect: '/account/center',
    children: [
      {
        path: '/account',
        component: RouteView,
        redirect: '/account/center',
        name: 'account',
        meta: { title: '个人管理', icon: 'user', keepAlive: true },
        children: [
          {
            path: '/account/center',
            name: 'center',
            component: () => import('@/pages/common/account/center/Index'),
            meta: { title: '个人中心', keepAlive: true }
          }
        ]
      },
      {
        path: '/system',
        name: 'system',
        redirect: '/system/menu',
        component: PageView,
        meta: { title: '系统管理', icon: 'setting', permission: [ 'system' ] },
        children: [
          {
            path: '/system/user',
            name: 'user',
            component: () => import('@/pages/system/user/List'),
            meta: { title: '用户管理', keepAlive: true, permission: [ 'user' ] }
          },
          {
            path: '/system/menu',
            name: 'menu',
            component: () => import('@/pages/system/menu/List'),
            meta: { title: '菜单管理', keepAlive: true, permission: [ 'menu' ] }
          },
          {
            path: '/system/role',
            name: 'role',
            component: () => import('@/pages/system/role/List'),
            meta: { title: '角色管理', keepAlive: true, permission: [ 'role' ] }
          },
          {
            path: '/system/version',
            name: 'version',
            component: () => import('@/pages/system/version/List'),
            meta: { title: 'app版本管理', keepAlive: true, permission: [ 'version' ] }
          }

        ]
      },
      // account
      {
        path: '/businessService',
        name: 'businessService',
        redirect: '/businessService/business',
        component: PageView,
        meta: { title: '服务商管理', icon: 'shop', permission: [ 'businessService' ] },
        children: [
          {
            path: '/businessService/business',
            name: 'business',
            component: () => import('@/pages/businessService/business/info'),
            meta: { title: '服务商', keepAlive: true,permission: [ 'business' ]}
          },
          {
            path: '/businessService/businessUser',
            name: 'businessUser',
            component: () => import('@/pages/businessService/businessUser/List'),
            meta: { title: '服务商用户', keepAlive: true,permission: [ 'businessUser' ]}
          },
          // {
          //   path: '/businessService/businessAdvertisement',
          //   name: 'businessAdvertisement',
          //   component: () => import('@/pages/businessService/businessAdvertisement/List'),
          //   meta: { title: '广告管理', keepAlive: true,permission: [ 'businessAdvertisement' ]}
          // }
        ]
      },

      {
        path: '/agentService',
        name: 'agentService',
        redirect: '/agentService/agent',
        component: PageView,
        meta: { title: '代理商管理', icon: 'reconciliation', permission: [ 'agentService' ] },
        children: [
          {
            path: '/agentService/agent',
            name: 'agent',
            component: () => import('@/pages/agentService/agent/List'),
            meta: { title: '代理商', keepAlive: true, permission: [ 'agent' ] }
          },
          {
            path: '/agentService/agentUser',
            name: 'agentUser',
            component: () => import('@/pages/agentService/agentUser/List'),
            meta: { title: '代理商用户', keepAlive: true,permission: [ 'agentUser' ]}
          }
        ]
      },

      {
        path: '/advertisementService',
        name: 'advertisementService',
        redirect: '/advertisementService/businessAdvertisement',
        component: PageView,
        meta: { title: '广告管理', icon: 'shop', permission: [ 'advertisementService' ] },
        children: [
          {
            path: '/advertisementService/businessAdvertisement',
            name: 'businessAdvertisement',
            component: () => import('@/pages/advertisementService/businessAdvertisement/List'),
            meta: { title: '广告', keepAlive: true,permission: [ 'businessAdvertisement' ]}
          },
          {
            path: '/advertisementService/advertisementDistribution',
            name: 'advertisementDistribution',
            component: () => import('@/pages/advertisementService/advertisementDistribution/List'),
            meta: { title: '广告分配', keepAlive: true,permission: [ 'advertisementDistribution' ]}
          }
        ]
      },
      {
        path: '/merchantService',
        name: 'merchantService',
        redirect: '/merchantService/merchant',
        component: PageView,
        meta: { title: '商户管理', icon: 'shop', permission: [ 'merchantService' ] },
        children: [
          {
            path: '/merchantService/merchant',
            name: 'merchant',
            component: () => import('@/pages/merchantService/merchant/List'),
            meta: { title: '商户', keepAlive: true,permission: [ 'merchant' ]}
          },
          {
            path: '/merchantService/merchantUser',
            name: 'merchantUser',
            component: () => import('@/pages/merchantService/merchantUser/List'),
            meta: { title: '商户用户', keepAlive: true,permission: [ 'merchantUser' ]}
          },
          {
            path: '/merchantService/merchantAdvertisement',
            name: 'merchantAdvertisement',
            component: () => import('@/pages/merchantService/merchantAdvertisement/List'),
            meta: { title: '广告管理', keepAlive: true,permission: [ 'merchantAdvertisement' ]}
          },
          {
            path: '/merchantService/memberLevel',
            name: 'memberLevel',
            component: () => import('@/pages/merchantService/memberLevel/List'),
            meta: { title: '会员等级', keepAlive: true, permission: [ 'memberLevel' ] }
          }
        ]
      },
      {
        path: '/storeService',
        name: 'storeService',
        redirect: '/storeService/store',
        component: PageView,
        meta: { title: '门店管理', icon: 'home', permission: [ 'storeService' ] },
        children: [
          {
            path: '/storeService/store',
            name: 'store',
            component: () => import('@/pages/storeService/store/List'),
            meta: { title: '门店', keepAlive: true,permission: [ 'store' ]}
          },
          {
            path: '/storeService/storeUser',
            name: 'storeUser',
            component: () => import('@/pages/storeService/storeUser/List'),
            meta: { title: '门店店员', keepAlive: true,permission: [ 'storeUser' ]}
          }
        ]
      },
      {
        path: '/deviceService',
        name: 'deviceService',
        redirect: '/deviceService/device',
        component: PageView,
        meta: { title: '设备管理', icon: 'safety-certificate', permission: [ 'deviceService' ] },
        children: [
          {
            path: '/deviceService/device',
            name: 'device',
            component: () => import('@/pages/deviceService/device/List'),
            meta: { title: '设备', keepAlive: true, permission: [ 'device' ] }
          }
        ]
      },
      {
        path: '/receiverService',
        name: 'receiverService',
        redirect: '/receiverService/receiver',
        component: PageView,
        meta: { title: '分账账户管理', icon: 'file-done', permission: [ 'receiverService' ] },
        children: [
          {
            path: '/receiverService/receiver',
            name: 'receiver',
            component: () => import('@/pages/receiverService/receiver/List'),
            meta: { title: '分账账户', keepAlive: true,permission: [ 'receiver' ]}
          }
        ]
      },
      {
        path: '/transactionService',
        name: 'transactionService',
        redirect: '/transactionService/order',
        component: PageView,
        meta: { title: '交易管理', icon: 'account-book', permission: [ 'transaction' ] },
        children: [
          {
            path: '/transactionService/order',
            name: 'order',
            component: () => import('@/pages/transactionService/order/List'),
            meta: { title: '订单记录', keepAlive: true,permission: [ 'order' ]}
          }
        ]
      },
      {
        path: '/memberService',
        name: 'memberService',
        redirect: '/memberService/member',
        component: PageView,
        meta: { title: '会员管理', icon: 'solution', permission: [ 'memberService' ] },
        children: [
          {
            path: '/memberService/member',
            name: 'member',
            component: () => import('@/pages/memberService/member/List'),
            meta: { title: '会员', keepAlive: true,permission: [ 'member' ]}
          }
        ]
      },
      // Exception
      {
        path: '/exception',
        name: 'exception',
        component: RouteView,
        redirect: '/exception/403',
        meta: { title: '异常页', icon: 'warning', permission: [ 'exception' ] },
        children: [
          {
            path: '/exception/403',
            name: 'Exception403',
            component: () => import(/* webpackChunkName: "fail" */ '@/pages/common/exception/403'),
            meta: { title: '403', permission: [ 'exception' ] }
          },
          {
            path: '/exception/404',
            name: 'Exception404',
            component: () => import(/* webpackChunkName: "fail" */ '@/pages/common/exception/404'),
            meta: { title: '404', permission: [ 'exception' ] }
          },
          {
            path: '/exception/500',
            name: 'Exception500',
            component: () => import(/* webpackChunkName: "fail" */ '@/pages/common/exception/500'),
            meta: { title: '500', permission: [ 'exception' ] }
          }
        ]
      },
    ]
  },
  {
    path: '*', redirect: '/404', hidden: true
  }
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
  {
    path: '/user',
    component: UserLayout,
    redirect: '/user/login',
    hidden: true,
    children: [
      {
        path: 'login',
        name: 'login',
        component: () => import(/* webpackChunkName: "user" */ '@/pages/common/login/Login')
      },
      {
        path: 'register',
        name: 'register',
        component: () => import(/* webpackChunkName: "user" */ '@/pages/common/login/Register')
      },
      {
        path: 'register-result',
        name: 'registerResult',
        component: () => import(/* webpackChunkName: "user" */ '@/pages/common/login/RegisterResult')
      }
    ]
  },
  {
    path: '/404',
    component: () => import(/* webpackChunkName: "fail" */ '@/pages/common/exception/404')
  }
]
